package cn.iocoder.yudao.module.ai.dal.mysql.operationscene;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ai.dal.dataobject.operationscene.OperationSceneDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ai.controller.admin.operationscene.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 运营中心-场景监控 Mapper
 *
 * @author 侯俊青
 */
@Mapper
public interface OperationSceneMapper extends BaseMapperX<OperationSceneDO> {

    default PageResult<OperationSceneDO> selectPage(OperationScenePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OperationSceneDO>()
                .eqIfPresent(OperationSceneDO::getFromMessageId, reqVO.getFromMessageId())
                .eqIfPresent(OperationSceneDO::getFromMessageIndex, reqVO.getFromMessageIndex())
                .inIfPresent(OperationSceneDO::getCompanyId, reqVO.getCompanyIds())
                .eqIfPresent(OperationSceneDO::getSceneId, reqVO.getSceneId())
                .likeIfPresent(OperationSceneDO::getEquName, reqVO.getEquName())
                .eqIfPresent(OperationSceneDO::getEquType, reqVO.getEquType())
                .eqIfPresent(OperationSceneDO::getVideoType, reqVO.getVideoType())
                .eqIfPresent(OperationSceneDO::getVideoPath, reqVO.getVideoPath())
                .eqIfPresent(OperationSceneDO::getServerPath, reqVO.getServerPath())
                .eqIfPresent(OperationSceneDO::getLatency, reqVO.getLatency())
                .eqIfPresent(OperationSceneDO::getPacketLossRate, reqVO.getPacketLossRate())
                .likeIfPresent(OperationSceneDO::getModelName, reqVO.getModelName())
                .likeIfPresent(OperationSceneDO::getGpuName, reqVO.getGpuName())
                .betweenIfPresent(OperationSceneDO::getTaskStartTime, reqVO.getTaskStartTime())
                .betweenIfPresent(OperationSceneDO::getTaskEndTime, reqVO.getTaskEndTime())
                .betweenIfPresent(OperationSceneDO::getExecutionStartTime, reqVO.getExecutionStartTime())
                .betweenIfPresent(OperationSceneDO::getExecutionEndTime, reqVO.getExecutionEndTime())
                .betweenIfPresent(OperationSceneDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(OperationSceneDO::getSuplierId, reqVO.getSuplierId())
                .eqIfPresent(OperationSceneDO::getIndustryAffiliation, reqVO.getIndustryAffiliation())
                .eqIfPresent(OperationSceneDO::getSceneClassification, reqVO.getSceneClassification())
                .orderByDesc(OperationSceneDO::getId));
    }

    OperationSceneRespCountVO countOperationScene(@Param("companyIds") List<String> companyIds,@Param("industryAffiliation") String industryAffiliation, @Param("sceneClassification") String sceneClassification);
}